package gjtx6;

import java.util.Scanner;

public class SupermarketTset {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        Supermarket sp=new Supermarket("合家福超市","繁华街888号");
        System.out.println(sp.toString());
        int k=0;
        while (true){
            System.out.println("欢迎使用合家福超市会员系统，你可使用如下功能：");
            System.out.println("1会员开卡,2查询积分,3积分累计,4积分兑换,5修改密码,6退出系统");
            System.out.print("请选择：");
            k=in.nextInt();
            if (k==1){
                System.out.println("请输入会员的帐号：");
                String number=in.next();
                System.out.println("请输入会员的姓名：");
                String name=in.next();
                System.out.println("请输入会员手机号：");
                String phone=in.next();
                System.out.println("请输入会员的积分：");
                int integral=in.nextInt();
                System.out.println("请输入会员的密码：");
                String password=in.next();
                sp.card(number,name,phone,integral,password);
            }else if (k==2){
                sp.inquires();
            }else if (k==3){
                System.out.println("请输入会员的帐号：");
                String number=in.next();
                System.out.println("请输入会员的密码：");
                String password=in.next();
                System.out.println("请输入会员的积分：");
                int integrals=in.nextInt();
                boolean b=sp.accumulation(number,integrals,password);
                if (b==true){
                    System.out.println("积分已累计！");
                }else {
                    System.out.println("积分累计失败！");
                }
            }else if (k==4){
                System.out.println("请输入会员的帐号：");
                String number=in.next();
                System.out.println("请输入会员的密码：");
                String password=in.next();
                System.out.println("选择兑换的礼品：");
                System.out.println("1.100积分一个牙膏");
                System.out.println("2.500积分一个小型风扇");
                System.out.println("3.2000积分一个电水壶");
                System.out.println("4.5000积分一个电饭锅");
                System.out.println("5.20000积分一个vovo手机");
                int j=in.nextInt();
                if (j==1){
                    int integrals=100;
                    sp.conversion(number,password,integrals);
                }else if (j==2){
                    int integrals=500;
                    sp.conversion(number,password,integrals);
                }else if (j==3){
                    int integrals=2000;
                    sp.conversion(number,password,integrals);
                }else if (j==4){
                    int integrals=5000;
                    sp.conversion(number,password,integrals);
                }else if (j==5){
                    int integrals=20000;
                    sp.conversion(number,password,integrals);
                }
            }else if (k==5){
                System.out.println("请输入会员的帐号：");
                String number=in.next();
                System.out.println("请输入会员的旧密码：");
                String password=in.next();
                System.out.println("请输入会员的新密码：");
                String passwords=in.next();
                sp.modiflcation(number,password,passwords);
            }else if (k==6){
                break;
            }
        }
    }
}
